<template>
  <div class="nav-bar">
   <span @click="$router.back()">返回</span>
   {{title}}
   <span>...</span>
  </div>
</template>

<script>
export default {
  name: 'Navbar',
  data () {
    return {
      title: ''
    }
  },
  watch: {
    $route: {
      handler: function (newVal) {
        this.title = newVal.meta.title
      },
      immediate: true
    }
  }
}
</script>

<style lang="less" scoped>
.nav-bar{
    width: 100%;
    height: 36px;
    color: #fff;
    text-align: center;
    line-height: 36px;
    background: cornflowerblue;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    span{
      margin:0px 10px;
    }
}
</style>
